﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Diagnostics;

namespace WasaWasa
{
    /// <summary>
    /// 例外の発生を通知するウィンドウです。
    /// </summary>
    partial class ExceptionWindow : Window
    {
        private ExceptionWindow(Exception ex)
        {
            InitializeComponent();
            txtExceptionString.Text = ex.ToString().Replace("---> ", "\r\n");
        }

        /// <summary>
        /// 例外を指定してExceptionWindowを表示します。
        /// </summary>
        /// <param name="ex">発生した例外</param>
        public static void Show(Exception ex)
        {
            ExceptionWindow win = new ExceptionWindow(ex);
            try
            {
                win.ShowDialog();
            }
            catch { }
        }

        private void btnOK_Click(object sender, RoutedEventArgs e)
        {
            Close();
        }

        private void Hyperlink_RequestNavigate(object sender, System.Windows.Navigation.RequestNavigateEventArgs e)
        {
            Process.Start(e.Uri.AbsoluteUri);
        }
    }
}
